package com.xqt.service.area;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.xqt.base.dao.BaseDao;
import com.xqt.base.entity.BaseEntity;
import com.xqt.base.service.BaseService;
import com.xqt.dao.area.AreaDao;
import com.xqt.entity.area.Area;
import com.xqt.inters.service.area.IAreaService;

/**
 * Desc:
 * Author:liubo
 * Date: 2017-03-21 15:28
 **/
public class AreaService extends BaseService<Area>  implements IAreaService {

    @Autowired
    private AreaDao areaDao;

    @Override
    public void add(Area area) throws Exception {
        preAdd(area);
        areaDao.add(area);
    }

    public void update(Area area) throws Exception {
         preUpdate(area);
         areaDao.updateBySelective(area);
    }

    @Override
    public void delete(Object... ids) {
        if (ids == null || ids.length < 1) {
            return;
        }
        // 删除缓存中对应所属关系
        for (Object id : ids) {
            areaDao.delete(id);
        }
    }


    @Override
    public void updateBySelective(Area area) throws Exception {
        preUpdate(area);
        areaDao.updateBySelective(area);
    }

    @Override
    public int queryByCount(BaseEntity page) {
        return areaDao.queryByCount(page);
    }

    @Override
    public List<Area> queryByList(BaseEntity page) {
        return areaDao.queryByList(page);
    }

    @Override
    public List<Area> getDictList(Area area) {
        return areaDao.getAreaList(area);
    }

	@Override
	public BaseDao<Area> getDao() {
		return areaDao;
	}
}
